<extend name="Base/base" />
<block name='head'>
    <meta charset="utf-8">
    <link href="/Public/static/dropload/dropload.css" rel="stylesheet" />
    <!--<link href="/Public/Index/css/page.css" rel="stylesheet" />-->
    <link href="/Public/Index/css/workflow.css" rel="stylesheet" /> 
    <style>
        .transferred_table table th,.transferred_table table .right {
            font-size:1.2em;
            padding:0.5em;
            border:none;
        }
        .transferred_table table .left{
            font-size:1.4em;
            padding:0.5em 0.6em 0.5em 1em;
            border:none;
        }
        .transferred_table table td a {
            color:#333;
        }
    </style>
</block>
<block name="content" > 
    <div class="transferred_table">
        <table border="1">
            <!--            <tr>
                            <td>标题</td>
                            <td>发布时间</td>
                        <if condition="$type eq 2">
                            <td>状态</td>
                            <td>操作</td>
                        </if>
                        </tr>-->
            <notempty name="lists">
                <foreach name="lists" item="list">
                    <tr>
                        <td class="left" style='text-align:left;'>
                            <a href="{:U('show',array('notify_id'=>$list['notify_id'],'type'=>$type))}">{$list.subject}</a>
                        </td>
                        <td class="right" width="22%" style="color:#999">{$list.time}</td>
                    <if condition="$type eq 2">
                        <td>{$list.publish|getNoticeStatus}</td>
                        <td width='15%'>
                        <if condition="$auditer eq 'lishaopu'">
                            <a class='pointer verifyNotice' data-id='{$list.notify_id}'>审&nbsp;批</a>&nbsp;|&nbsp;
                            <else/>
                            <if condition="$list[publish] eq 3">
                                <a class="pointer reason" data-id="{$list.notify_id}">意 见</a> | 
                                <else/>
                                <a href="{:U('saveNotice',array('notify_id'=>$list['notify_id']))}">修&nbsp;改</a>&nbsp;|&nbsp;
                            </if>
                        </if>
                        <a class='pointer delNotice' data-id="{$list.notify_id}"> 删&nbsp;除</a>
                        </td>
                    </if>
                    </tr>
                </foreach>
                <else />
                <tr><td colspan="5" style="text-align: left">暂无数据</td></tr>
            </notempty>
        </table>
        <!--<div class="page">{$pages}</div>-->
        <input type="hidden" id="is_read" value="{$type}">
        <input type="hidden" id="url" value="{:U('dropload')}">
        <input type="hidden" id="delurl" value="{:U('Notice/delNotice')}">
    </div>
    <div class="button">
        <a class="am-btn back" data-url="{:U('index')}">返 回</a>
    </div>
</block>
<block name="script">
    <script type="text/javascript" src="/Public/static/dropload/dropload.js" ></script>
    <script type="text/javascript" src="/Public/Index/js/form.js"></script>
    <script type="text/javascript" src="/Public/Index/js/notice.js"></script>
    <script type="text/javascript">
        $('.back').on('click', function () {
            location.href = $(this).attr('data-url')
        })
        $(initDelNotice());
        $(function () {
            p = 2;
            var dropload = $('.transferred_table').dropload({
                scrollArea: window,
                domDown: {
                    domClass: 'dropload-down',
                    domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
                    domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
                    domNoData: '<div class="dropload-noData">已无数据</div>'
                },
                loadDownFn: function (me) {
                    var url = $('#url').val() + '?p=' + p + '&type=' + $('#is_read').val();
                    p++;
                    $.ajax({
                        url: url,
                        type: 'get',
                        success: function (res) {
                            console.log(res);
                            if (res.length > 0) {
                                var html = '';
                                for (var i = 0; i < res.length; i++) {
                                    html += '<tr><td style="text-align:left"><a href="/index.php/Index/Notice/show/notify_id/' + res[i].notify_id + '">' + res[i].subject + '</a></td>';
                                    html += '<td>' + res[i].send_time + '</td>';
                                    if (res[0].type == 2) {
                                        html += '<td>' + res[i].publish + '</td>';
                                        if (res[i].auditer == 'lishaopu') {
                                            html += '<td><a class="pointer verifyNotice" data-id="' + res[i].notify_id + '">审 批</a> | ';
                                        } else {
                                            if (res[i].verify == 3) {
                                                html += '<a class="pointer reason">意 见</a> | ';
                                            } else {
                                                html += '<td><a href="/index.php/Index/Notice/saveNotice/notify_id/' + res[i].notify_id + '">修 改</a> | ';
                                            }
                                        }
                                        html += '<a class="pointer delNotice" data-id=' + res[i].notify_id + '>删 除</a></td>';
                                    }
                                    html += '</tr>';
                                }
                                $('.transferred_table tr:last').after(html);
                            } else {
                                me.noData();
                            }
                            me.resetload();
                        }
                    })
                }
            });
        })

    </script>
</block>
